// let versions = [{
//     ours: '',
//     theirs: '',
//     base: '',
//     resolution: '',
// }]
let versions = []

export default function handler(req, res) {
    if (req.method === 'POST') {
        const chunks = req.body
        // console.log(chunks)
        versions = []
        for (const c of chunks) {
            versions.push({
                ours: c.a_content,
                theirs: c.b_content,
                base: c.o_content,
                resolution: c.r_content,
            })
        }
        res.status(200).json({ message: 'Text updated successfully' })
    } else if (req.method === 'GET') {
        res.status(200).json(versions) // 返回存储的文本
    } else {
        res.status(405).json({ message: 'Method Not Allowed' })
    }
}
